package rulehandlers;

import com.creativewidgetworks.goldparser.engine.ParserException;
import com.creativewidgetworks.goldparser.engine.Reduction;
import com.creativewidgetworks.goldparser.parser.GOLDParser;
import com.creativewidgetworks.goldparser.parser.ProcessRule;

// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
    "<Value> ::= Identifier"    
})

/**
 * Rule handler for the VALUE_IDENTIFIER rule.
 */
public class RuleHandler20 extends Reduction {
    private GOLDParser theParser;

    public RuleHandler20(GOLDParser parser) {
        theParser = parser;  // Save so execute() has access.
        Reduction reduction = parser.getCurrentReduction();
        if (reduction != null) {
            // Example block that ensures at least 1 parameter is provided, but not more than 2.
            if (reduction.size() > 0 && reduction.size() < 3) { 
                // Insert your code here
            } else {
                parser.raiseParserException("Wrong number of parameters: expected 1..2, but got " + reduction.size() + ".");
            }
        } else {
            parser.raiseParserException(getClass().getSimpleName() + " expected to find a current reduction object.");
        }          
    }

    @Override
    public void execute() throws ParserException {
        // Insert your code here
    }
}

